<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
  </head>
  <body onUnload="importClose()">
    <form id="inboundImportFile" action="inboundAction_ajaxCopyFile.action" 
    	enctype="multipart/form-data"  method="post">
    <table>
      <tr>
	 	 <td>
           	<input type="file" name="importFile"  id="importFile"  size="50"  />
           	<input type="button" id=""importSubmit"" id="importSubmit" value="导入" onclick="submitForm()" />
           	<input type="button"  name="fileClear"  id="fileClear"  value="清空"/>
           	<input type="hidden" name="array"  id="array"/>
         </td>
	  </tr>
    </table>
    </form>
  </body>
  <script type="text/javascript">
	function submitForm(){  
		var file = document.getElementById("importFile").value;
		var fileType = file.substring( file.lastIndexOf(".") , file.length);
		
		if( file == null || file == "" ){
			alert("上传文件为空！");
			return;
		}
		
		if( fileType != ".xls"){
			alert("文件格式不对！文件格式需为03版本excel");
			return;
		}
		
		if( file.indexOf("\\") != -1 ){
			var fileName = file.substring( file.lastIndexOf("\\") + 1 , file.length);    
	    	document.getElementById("array").value = fileName;
		}else{
			document.getElementById("array").value = file;
		}
		window.opener.document.getElementById("array").value=document.getElementById("array").value;
		alert(window.opener.document.getElementById("array").value);
		alert(document.getElementById("array").value);
		var form = document.getElementById("inboundImportFile");
		form.submit();

    }
	function importClose(){
		window.opener.loadExcelFileInfo();
	}
  </script>
</html>
